#ifndef SWP_ACTIVITY_GRAPHIC_ITEM_H
#define SWP_ACTIVITY_GRAPHIC_ITEM_H

#include "abstractrectgraphicitem.h"

namespace gui
{
class LineEditDelegate;
class ListDelegate;
}

namespace swp
{

class SwpActivityGraphicItem : public AbstractRectGraphicItem
{
public:
    SwpActivityGraphicItem(const QString& name = QString(),
        QGraphicsItem* parent = 0);
    virtual ~SwpActivityGraphicItem();

    // IEditorItem
    virtual bool supportsConnection(
        const core::ConnectionData& connection) const;

    virtual int type() const;

    QString name() const;

    virtual IEditorItem* copy() const;

    // ISerializable
    virtual void deserializationFinished(bool ok);

    // IPropertyObject
    virtual QList<core::Property> properties() const;

    virtual QVariant propertyValue(const QString& propertyName) const;

    virtual void propertyChanged(const QString& property,
        const QVariant& newValue, bool silent = false);

    virtual QVariantList optionList(const QString& propertyName) const;
    virtual QVariantList autocomplete(const QString& propertyName) const;

protected:
    virtual QVariant itemChange(GraphicsItemChange change,
        const QVariant &value);
    // AbstractPolygonGraphicItem
    QList<QPointF> scalePoints() const;
    QList<QPointF> connectPoints() const;
    QList<QPointF> selfConnectAnchorPoints() const;

private:
    bool containsSameConnection(const core::ConnectionData& connection,
        const QList<core::ConnectionData>& connections) const;

    int outgoingConnectionSize(
        const QList<core::ConnectionData>& connections) const;

protected:
    QString m_name;
    core::Property m_nameProp;
    core::Property m_inputProp;
    core::Property m_outputProp;
    core::Property m_actionsProp;
    gui::LineEditDelegate* m_nameDelegate;
    gui::ListDelegate* m_actionsDelegate;
};

} // namespace swp

#endif
